<?php

// +----------------------------------------------------------------------
// | Shop-Demo for ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2022~2023 Anyon <zoujingli@qq.com>
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
// | 免责声明 ( https://thinkadmin.top/disclaimer )
// | 会员免费 ( https://thinkadmin.top/vip-introduce )
// +----------------------------------------------------------------------
// | gitee 代码仓库：https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库：https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------

namespace app\data\controller\zck;

use app\data\model\DataZhengcekuJinzhan as DataNewsMark;
use think\admin\Controller;
use think\admin\helper\QueryHelper;
use think\facade\Db;

/**
 * 添加进展
 * Class Mark
 * @package app\data\controller\news
 */
class ZhengcekuJinzhan extends Controller
{
    /**
     * 添加进展
     *
     * @return void
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function index()
    {
        DataNewsMark::mQuery()->layTable(function () {
            $this->title = '添加进展';
            $this->zc_id = $this->get['zc_id'];
            //dump($order_id);die;
        }, function (QueryHelper $query) {
            $query->where(['deleted' => 0]);
            $query->like('name')->equal('status,zc_id')->dateBetween('create_at');
        });
    }

    /**
     * 数据列表处理
     * @param array $data
     */
    protected function _page_filter(array &$data)
    {
        foreach ($data as &$v){
            $v['zc_id'] = Db::name('data_zhengceku_jinzhan')->where('id',$v['zc_id'])->value('title');
        }

    }
    /**
     * 添加文章标签
     *
     */
    public function add()
    {
        DataNewsMark::mForm('form');
    }

    /**
     * 编辑文章标签
     *
     */
    public function edit()
    {
        DataNewsMark::mForm('form');
    }


    protected function _form_filter(array &$data)
    {
        $zc_id = input('zc_id');
        if ($this->request->isGet()) {
            $this->zc_id = $zc_id;
        } else {

        }
    }

    /**
     * 表单结果处理
     * @param bool $state
     * @return void
     */
    protected function _form_result(bool $state)
    {
        if ($state) {
            $this->success('添加成功', "javascript:$('#TagsData').trigger('reload')");
        }
    }

    /**
     * 修改文章标签状态
     *
     */
    public function state()
    {
        DataNewsMark::mSave();
    }

    /**
     * 删除文章标签
     *
     */
    public function remove()
    {
        DataNewsMark::mDelete();
    }
}